package com.hspedu.codeblock;

public class CodeBlockDetail02 {
    public static void main(String[] args) {
        A a = new A();

    }
}

class A{
    private static int n1 =getN1() ;


    //普通代码块
    {
        System.out.println("A 非静态代码块被执行~~");//3
    }

    private int n2 = getN2();
    static{//静态代码块
        System.out.println("A 静态代码块被执行~~");//2
    }

    public static int getN1(){
        System.out.println("getN1() 静态方法被执行~~");//1
        return 100;
    }

    public int getN2(){
        System.out.println("getN2() 非静态方法被执行~~");//4
        return 200;
    }

    public A() {
        System.out.println("A 的无参构造器被执行~~");//6 最后被执行
    }
}
